// src/main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import './assets/styles/global.css'

// 使用 import 导入图片
import backgroundImg from './assets/images/background.png'

// src/main.js
const setBackgroundImage = () => {
  try {
    const root = document.documentElement;
    root.style.setProperty('--app-background-image', `url(${backgroundImg})`);
    console.log('背景图已设置:', backgroundImg);

    const style = document.createElement('style');
    style.textContent = `
      .app-background {
        background-image: url(${backgroundImg}) !important;
        background-size: cover !important;
        background-position: center !important;
        background-repeat: no-repeat !important;
      }

      .agent-dialog-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image: url(${backgroundImg}) !important;
        background-size: cover !important;
        background-position: center !important;
        background-repeat: no-repeat !important;
        z-index: 999;
        opacity: 0.8;
      }

      .agent-dialog-fullscreen {
        // background: transparent
        border-radius: 16px;
        padding: 20px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
      }
    `;
    document.head.appendChild(style);
  } catch (error) {
    console.error('设置背景图失败:', error);
  }
};
setBackgroundImage();

const app = createApp(App)
app.use(router)
app.mount('#app')
